package com.android.equipment.adapter

import com.android.equipment.R
import com.android.equipment.dao.TeamGroup
import com.android.equipment.dao.operate.DaoTeamGroupDetail
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jet.flowtaglayout.FlowTagLayout

class PeopleGroupAdapter(resId: Int):BaseQuickAdapter<TeamGroup,BaseViewHolder>(resId) {
    override fun convert(holder: BaseViewHolder, item: TeamGroup) {
        holder.setText(R.id.tv_group_name,"班组名称：${item.groupName}")
        val teamGroupDetailList =
            DaoTeamGroupDetail.getInstance().getTeamGroupDetailByGroupId(item.id)
        if (teamGroupDetailList.isNotEmpty()){
            val flowTagLayout = holder.getView<FlowTagLayout>(R.id.flowTagLayout)
            flowTagLayout.addTags(teamGroupDetailList.map {
                it.peopleName
            })
        }


    }
}